<!DOCTYPE html>
<html>

<head>
    <!-- 页面meta -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>商家管理</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">
    <link rel="stylesheet" href="/plugins/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="/plugins/adminLTE/css/AdminLTE.css">
    <link rel="stylesheet" href="/plugins/adminLTE/css/skins/_all-skins.min.css">
    <link rel="stylesheet" href="/css/style.css">
	<script src="/plugins/jQuery/jquery-2.2.3.min.js"></script>
    <script src="/plugins/bootstrap/js/bootstrap.min.js"></script>
	<!--        Toastr提示信息5-->
	<script src="/js/toastr/toastr.min.js"></script>
	<link href="/js/toastr/toastr.css" rel="stylesheet">
	<!--bootstrap-dialog模态框，一般用于增加修改弹出一个窗口-->
	<script src="/js/bootstrap-dialog/dist/js/bootstrap-dialog.js"></script>
	<link href="/js/bootstrap-dialog/dist/css/bootstrap-dialog.css" rel="stylesheet">
    
</head>

<body class="hold-transition skin-red sidebar-mini"  >
  <!-- .box-body -->
                <div class="box box-primary">
                    <div class="box-header with-border">
                        <h3 class="box-title">商家管理</h3>
						<button type="button" class="btn btn-default" title="刷新" onclick="window.location.reload();"><i class="fa fa-refresh"></i> 刷新</button>
                    </div>

                    <div class="box-body">

                        <!-- 数据表格 -->
                        <div class="table-box">

                            <!--工具栏-->
                            
                            <div class="box-tools pull-right">
                                <div class="has-feedback">
							        公司名称：<input  >
									店铺名称： <input  >
									状态：
									<input type="radio" value="" />全部
									<input type="radio" value="0" />待审核
									<input type="radio" value="1" />已审核
									<input type="radio" value="2" />审核未通过
									<input type="radio" value="3" />关闭
									<button class="btn btn-default" >查询</button>                                    
                                </div>
                            </div>
                            <!--工具栏/-->

			                  <!--数据列表-->
			                  <table id="dataList" class="table table-bordered table-striped table-hover dataTable">
			                      <thead>
			                          <tr>
			                              <th class="" style="padding-right:0px">
			                                  <input id="selall" type="checkbox" class="icheckbox_square-blue">
			                              </th> 
										  <th class="sorting_asc">商家ID</th>
									      <th class="sorting">公司名称</th>
									      <th class="sorting">店铺名称</th>
									      <th class="sorting">联系人姓名</th>
									      <th class="sorting">公司电话</th>
									      <th class="sorting">状态</th>										
					                      <th class="text-center">操作</th>
			                          </tr>
			                      </thead>
<!--								  主页面-->
			                      <tbody id="tbodyid">
			                      </tbody>
			                  </table>
			                  <!--数据列表/-->
                        </div>
                        <!-- 数据表格 /-->
                     </div>
                    <!-- /.box-body -->

<script>
	$(function (){

		//主页面
		$.ajax({
			url:"/sell/getall",
			type:"post",
			dataType:"json",
			data:{},
			async:true,
			success:function (result){
				// console.log(result)
				if(result.code==10000){
					var ticat=result.data;
					// console.log(ticat)
					var html="";
					for(var i=0;i<ticat.length;i++) {
						if(ticat[i].status=='1'){
							ss="审核通过"
						}else if(ticat[i].status=='2'){
							ss="审核未通过"
						}else if(ticat[i].status=='0'){
							ss="待审核"
						}
						html += ' <tr >';
						html += ' <td><input  type="checkbox"></td> ';
						html += ' <td>'+ticat[i].sellerId+'</td>';
						html += ' <td>'+ticat[i].name+'</td>';
						html += ' <td>'+ticat[i].nickName+'</td>';
						html += ' <td>'+ticat[i].linkmanName+'</td>';
						html += ' <td>'+ticat[i].telephone+'</td>';
						// <input id="in1" type="text" value="'+ticat[i].status+'">
						html += ' <td id="td1">'+ss+'    </td>';
						html += ' <td class="text-center">';
						// 传值需要用转义符
						html += ' <button type="button" onclick="xiangqing(\''+ticat[i].sellerId+'\')" class="btn bg-olive btn-xs" data-toggle="modal" data-target="#sellerModal" >详情</button>';
						html += ' </td>';
						html += ' </tr>';
					}
					$("#tbodyid").html(html)
				}
			},error:function (){
				alert("系统异常")
			}
		})


	})




	//详情显示
	function xiangqing(id){
		var sellerId=id;
		$.ajax({
			url:"/sell/byid",
			type:"post",
			dataType:"json",
			data:{sellerId:sellerId},
			async:false,
			success:function (result){
				if(result.code==10000){
					var datas=result.data
					// console.log(result.data)
					var ji="";//基本信息
					var lian="";//联系人
					var zheng="";//证件
					var fa="";//法人代表
					var hang="";//开户行
					//基本信息
					ji+='<tr>'
					ji+='<td>公司名称</td>'
					ji+='<td>'+datas.name+'</td>'
					ji+='<td> <input type="hidden" id="in2" value=" '+datas.status+' ">   </td>'//审核状态
					ji+='<td> <input type="hidden" id="in3" value=" '+datas.sellerId+' ">   </td>'//主键id
					ji+='</tr>'
					ji+='<tr>'
					ji+='<td>公司手机</td>'
					ji+='<td>'+datas.linkmanMobile+'</td>'
					ji+='</tr>'
					ji+='<tr>'
					ji+='<td>公司电话</td>'
					ji+='<td>'+datas.telephone+'</td>'
					ji+='</tr>'
					ji+='<tr>'
					ji+='<td>公司详细地址</td>'
					ji+='<td>'+datas.addressDetail+'</td>'
					ji+='</tr>'
					//联系人
					lian+='<tr>';
					lian+='<td>联系人姓名</td>';
					lian+='<td>'+datas.linkmanName+'</td>';
					lian+='</tr>';
					lian+='<tr>';
					lian+='<td>联系人QQ</td>';
					lian+='<td>'+datas.linkmanQq+'</td>';
					lian+='</tr>';
					lian+='<tr>';
					lian+='<td>联系人手机</td>';
					lian+='<td>'+datas.linkmanMobile+'</td>';
					lian+='</tr>';
					lian+='<tr>';
					lian+='<td>联系人E-Mail</td>';
					lian+='<td>'+datas.linkmanEmail+'</td>';
					lian+='</tr>';
					//证件
					zheng+='<tr>';
					zheng+='<td>营业执照号</td>';
					zheng+='<td>'+datas.licenseNumber+'</td>';
					zheng+='</tr>';
					zheng+='<tr>';
					zheng+='<td>税务登记证号</td>';
					zheng+='<td>'+datas.taxNumber+'</td>';
					zheng+='</tr>';
					zheng+='<tr>';
					zheng+='<td>组织机构代码证号</td>';
					zheng+='<td>'+datas.orgNumber+'</td>';
					zheng+='</tr>';
					//法人代表
					fa+='<tr>';
					fa+='<td>法定代表人</td>';
					fa+='<td>'+datas.legalPerson+'</td>';
					fa+='</tr>';
					fa+='<tr>';
					fa+='<td>法定代表人身份证号</td>';
					fa+='<td>'+datas.legalPersonCardId+'</td>';
					fa+='</tr>';
					//开户行
					hang+='<tr>';
					hang+='<td>开户行名称</td>';
					hang+='<td>'+datas.bankName+'</td>';
					hang+='</tr>';
					hang+='<tr>';
					hang+='<td>开户行支行</td>';
					hang+='<td>'+datas.bankName+'</td>';
					hang+='</tr>';
					hang+='<tr>';
					hang+='<td>银行账号</td>';
					hang+='<td>'+datas.bankUser+'</td>';
					hang+='</tr>';
					$("#tables2").html(ji)//基本信息
					$("#tables3").html(lian)//联系人
					$("#tables4").html(zheng)//证件
					$("#tables5").html(fa)//法人代表
					$("#tables6").html(hang)//开户行
				}
			},error:function (){
				alert("系统异常")
			}
		})
	}

	//审核状态
	function tongguo (s){
		var status = String(s);
		// console.log(n)
		var sellerId=$("#in3").val()//主键
		// return
		$.ajax({
			url:"/sell/tongguo",
			type:"post",
			dataType:"json",
			data:{status:status,sellerId,sellerId},
			async:false,
			success:function (result){
				if(result.code==10000){
					toastr.success("修改成功")
					// dialog.close();//更新成功后关闭
				}
			},error:function (){
				alert("系统异常")
			}
		})
	}






</script>
                    
	          
					    
                                
<!-- 商家详情 -->
<div class="modal fade" id="sellerModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog modal-lg" >
	<div class="modal-content">
		<div class="modal-header">
			<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
			<h3 id="myModalLabel">商家详情</h3>
		</div>
		<div class="modal-body">							
			
			 <ul class="nav nav-tabs">
			  <li class="active"><a href="#home"  data-toggle="tab">基本信息</a></li>
			  <li><a href="#linkman" data-toggle="tab">联系人</a></li>
			  <li><a href="#certificate" data-toggle="tab">证件</a></li>
			  <li><a href="#ceo" data-toggle="tab">法定代表人</a></li>
			  <li><a href="#bank" data-toggle="tab">开户行</a></li>
			</ul>							
			
			<!-- 选项卡开始 -->         
		    <div id="myTabContent" class="tab-content">
			    <div class="tab-pane active in" id="home">
			      <br>
			      <table class="table table-bordered table-striped"  width="800px"  id="tables2">
<!--					  //基本信息-->
			      </table>			      
      			</div>	
			    <div class="tab-pane fade" id="linkman">
			    	<br>
					<table class="table table-bordered table-striped" id="tables3">
<!--						联系人-->
			      </table>
			    </div>
			    <div class="tab-pane fade" id="certificate">
					<br>
					<table class="table table-bordered table-striped" id="tables4" >
<!--						证件-->
			     	</table>
			    </div>
			    <div class="tab-pane fade" id="ceo">
					<br>
					<table class="table table-bordered table-striped" id="tables5" >
<!--						法定代表人-->
			     	</table>
			    </div>
			    <div class="tab-pane fade" id="bank">
					<br>
					<table class="table table-bordered table-striped" id="tables6">
<!--						开户行-->
			     	</table>					
			    </div>
  			    </div> 			
           <!-- 选项卡结束 -->          
			
			
		</div>
		<div class="modal-footer">						
			<button class="btn btn-success" onclick="tongguo(1)" data-dismiss="modal" aria-hidden="true">审核通过</button>
         	<button class="btn btn-danger"  onclick="tongguo(2)" data-dismiss="modal" aria-hidden="true">审核未通过</button>
            <button class="btn btn-danger" data-dismiss="modal" aria-hidden="true">关闭商家</button>
			<button class="btn btn-default" data-dismiss="modal" aria-hidden="true">关闭</button>
		</div>
	  </div>
	</div>
</div>


</body>

</html>